package com.ruoyi.environment.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.PreAuthorize;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.environment.domain.OpmEnvSoldTest;
import com.ruoyi.environment.service.IOpmEnvSoldTestService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 固废采集Controller
 *
 * @author cjie
 * @date 2021-07-23
 */
@Api(tags = " 固废采集")
@RestController
@RequestMapping("/opmEnvSoldTest")
public class OpmEnvSoldTestController extends BaseController {
    @Autowired
    private IOpmEnvSoldTestService opmEnvSoldTestService;

    /**
     * 查询固废采集列表
     */
    @ApiOperation(value="查询固废采集列表", notes="查询固废采集列表")
    @PreAuthorize(hasPermi = "environment:opmEnvSoldTest:list")
    @GetMapping("/list")
    public TableDataInfo list(OpmEnvSoldTest opmEnvSoldTest) {
        startPage();
        List<OpmEnvSoldTest> list = opmEnvSoldTestService.selectOpmEnvSoldTestList(opmEnvSoldTest);
        return getDataTable(list);
    }

    /**
     * 导出固废采集列表
     */
    @ApiOperation(value="导出固废采集列表", notes="导出固废采集列表")
    @PreAuthorize(hasPermi = "environment:opmEnvSoldTest:export")
    @Log(title = "固废采集", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, OpmEnvSoldTest opmEnvSoldTest) throws IOException {
        List<OpmEnvSoldTest> list = opmEnvSoldTestService.selectOpmEnvSoldTestList(opmEnvSoldTest);
        ExcelUtil<OpmEnvSoldTest> util = new ExcelUtil<OpmEnvSoldTest>(OpmEnvSoldTest.class);
        util.exportExcel(response, list, "固废采集数据");
    }
    /**
     * 获取固废采集详细信息
     */
    @ApiOperation(value="获取固废采集详细信息", notes="获取固废采集详细信息")
    @PreAuthorize(hasPermi = "environment:opmEnvSoldTest:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(opmEnvSoldTestService.selectOpmEnvSoldTestById(id));
    }

    /**
     * 新增固废采集
     */
    @ApiOperation(value="新增固废采集", notes="新增固废采集")
    @PreAuthorize(hasPermi = "environment:opmEnvSoldTest:add")
    @Log(title = "固废采集", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody OpmEnvSoldTest opmEnvSoldTest) {
        return toAjax(opmEnvSoldTestService.insertOpmEnvSoldTest(opmEnvSoldTest));
    }

    /**
     * 修改固废采集
     */
    @ApiOperation(value="修改固废采集", notes="修改固废采集")
    @PreAuthorize(hasPermi = "environment:opmEnvSoldTest:edit")
    @Log(title = "固废采集", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody OpmEnvSoldTest opmEnvSoldTest) {
        return toAjax(opmEnvSoldTestService.updateOpmEnvSoldTest(opmEnvSoldTest));
    }

    /**
     * 删除固废采集
     */
    @ApiOperation(value="删除固废采集", notes="删除固废采集")
    @ApiImplicitParam(name = "ids", value = "固废采集ID数组", required = true,paramType = "path", allowMultiple=true, dataType = "String")
    @PreAuthorize(hasPermi = "environment:opmEnvSoldTest:remove")
    @Log(title = "固废采集", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(opmEnvSoldTestService.deleteOpmEnvSoldTestByIds(ids));
    }
}
